package org.example.demoweb.demos.web;

import org.apache.dubbo.config.annotation.DubboService;
import org.example.User;
import org.example.UserService;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

/**
 * @author <a href="https://blog.qinghuan.fun/index.php/go/gu/">Mr_Gu</a>
 * @apiNote
 * @date 2024-04-11 09:15
 * @since
 **/
@DubboService(registry = {"demoozk1", "demoozk2", "demoonacos"})
public class UserServiceImpl implements UserService {

    Map<String, User> userMap = new HashMap<>();

    @PostConstruct
    public void init() {
        userMap.put("1", new User("1", "张三", 18));
        userMap.put("2", new User("2", "李四", 20));
        userMap.put("3", new User("3", "王五", 22));
        userMap.put("4", new User("4", "赵六", 24));
        userMap.put("5", new User("5", "孙七", 26));
    }

    @Override
    public User getUser(String id) {
        return userMap.get(id);
    }

}
